/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86136
 * Date: 2025-04-07
 * Time: 15:09
 */
public class Demo18 {
    public static int count = 0;
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 5000; i++) {
                count++;
            }
        });
        Thread t2 = new Thread(() -> {
            for (int i = 0; i < 5000; i++) {
                count++;
            }
        });
        //1.并行 count = 0
        //t1.start();
        //t2.start();

        //2.并行 count <= 10000
        //t1.start();
        //t2.start();
        //t1.join();
        //t2.join();

        //3.串行 count = 10000
        t1.start();
        t1.join();
        t2.start();
        t2.join();
        System.out.println(count);
    }
}
